package models

import (
	"kop/libs/database"
	"kop/modules/sign_in/entity"
)

func AutoMigrate() {
	database.DB.AutoMigrate(new(entity.User))
	database.DB.AutoMigrate(new(entity.Notice))
}

func GetUser(userName string) (*entity.User, error) {

	var user = &entity.User{UserName: userName}
	return user, database.DB.Where("user_name = ?", userName).FirstOrCreate(user).Error
}
